
#ifndef _ka_system_context_h
#define _ka_system_context_h

#include <vector>
#include "ka-system/thread.h"
#include "ka-system/event.h"

namespace ka {
    /**
     * 
     */
    class Context {
    public:
        Context();
        ~Context();
        
        static Context *getCurrent();
        
        int getEventChannel(const UUID &eventUid) const;
        EventHandler *getEventHandlers(int eventChannel) const;
        int setEventHandlers(EventHandler *eventHandlers);
        
    private:
        static ThreadLocal _threadLocal;
        
    private:
        std::vector<EventHandler *> _handlerSlots;
        Context *_base;
        bool _shadowed;
    };
    
    class IContextManifest {
    public:
        virtual ~IContextManifest();
        virtual Context *createContext() = 0;
        virtual void destroyContext(Context *context) = 0;
    };
}

#endif